#include<iostream>
#include<vector>
#include<unordered_map>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<numeric>

using namespace std;

class Solution {
public:
    string removeDuplicates(string S) {
        string ans;
        for(int i = 0; i < S.length(); i++){
            if(ans.empty() || ans[ans.length() - 1] != S[i])ans += S[i];
            else ans.pop_back();
        } 
        return ans;
    }
};


int main(){
}

//2021.3.9
//ջ


